package com.zhangfei.order.biz.assember;

import com.zhangfei.order.proto.order1.OrderServer;
import org.springframework.stereotype.Component;

/**
 * grpc和dto数据之间的转换工具，参数校验也放在这里
 */
@Component
public class OrderServerAssembler {


    /**
     * grpc  --- >   dto
     * @param request
     * @return
     */
    public String convertGrpcToDto(OrderServer.OrderConfirmRequest request) {
        //1.参数校验


        //2.参数转换
        String productId = request.getProductId();

        //3.返回参数
        return productId;
    }

    /**
     *  dto --- >   grpc
     * @param result
     * @return
     */
    public String convertTDtoTOGrpc(boolean result)  {

        //1.参数转换


        //2.返回参数
        return String.valueOf(result);

    }
}
